﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Icoders.MarketTracker.Core.Validation;


namespace Icoders.MarketTracker.Core.MasterData
{
    public enum UserType { MobileAppUser = 1, WebAppUser=2}

    public class User : MasterEntityBase
    {
        public User()
        {
            Roles = new List<string>();
        }
        [Display(Name = "User Type")]
        public int UserTypeId { get; set; }

        [Required(ErrorMessage = "Username is Required")]
        public string Username { get; set; }

        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm  password")]
        [Compare("Password", ErrorMessage = "The Password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }


        [Required(ErrorMessage = "First Name is Required")]
        public string FirstName { get; set; }

        [Required(ErrorMessage = "Last Name is Required")]
        public string LastName { get; set; }

        [Required(ErrorMessage = "Phone Number is Required")]
        [Display(Name = "Phone Number")]
        public string PhoneNumber { get; set; }
        //[Email]
        public string Email { get; set; }

        public DateTime LastLogin { get; set; }

        public string UserType { get; set; }
        public bool Enabled { get; set; }
        public bool ChangePass { get; set; }
        public List<string> Roles { get; set; }
        [Display(Name = "User access Group")]
        [Required(ErrorMessage = "User Group is Required")]
        public int GroupId { get; set; }
        public bool Reset { get; set; } 
    }
}
